#include<iostream>
#include<algorithm>
using namespace std;
const int N = 110;
int arr[N];
int b[N];
int n;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		b[i] = arr[i];
	}
	sort(b, b + n);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0 || b[i + 1] != b[i]) {
			b[cnt++] = b[i];
		}
	}
	int idx = 0;
	for (int i = 0; i < n; i++) {
		cout << arr[i] << " ";
	}
	cout << endl;
	for (int i = 0; i < n; i++) {
		idx = lower_bound(b, b + cnt, arr[i]) - b;
		cout << idx << " ";
	}
	return 0;
}